import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./assets/js/axios";
import vueFilter from "./assets/js/filter";
import vueDirective from "./assets/js/directive";

import { Toast, Button, Loading } from "vant";
Vue.use(Toast);
Vue.use(Loading);
Vue.use(Button);

// axios默认请求路径
axios.defaults.baseURL = "http://192.168.1.11:2002";
// 设置请求头
axios.defaults.headers.common["Authorization"] =
  sessionStorage.getItem("token") || null;
// productionTip设置为 false ，可以阻止 vue 在启动时生成生产提示
Vue.config.productionTip = false;

// 全局过滤器
for (let key in vueFilter) {
  Vue.filter(key, vueFilter[key]);
}
// 全局指令
for (let key in vueDirective) {
  Vue.directive(key, vueDirective[key]);
}

let $Vue = new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");

export default $Vue;
